const {parse,format} = require('path')
const filePath = '/usr/local/node_modules/n/p.json'
const ret = parse(filePath)
console.log(ret)
console.log(format(ret))

/*
输出结果：
{ root: '/',
  dir: '/usr/local/node_modules/n',
  base: 'p.json',
  ext: '.json',
  name: 'p' }

/usr/local/node_modules/n/p.json

 */